<template>
  <div class="home">
    <!-- 头部轮播图 -->
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <van-swipe-item v-for="(item, i) in banner" :key="i">
        <img :src="item.banner_img" alt="" />
      </van-swipe-item>
    </van-swipe>
     <!-- 热门推荐 -->
    <navSwipter></navSwipter>
   <!-- 资深讲师 -->
    <goodList :list='list'></goodList>
    <!-- 底部导航栏 -->
    <TabberBtn></TabberBtn>
  </div>
</template>

<script>
import navSwipter from "@/components/nav.vue";
import { getBanner, getUserList } from "@/tool/swipter";
import TabberBtn from "@/components/tabber.vue";
import goodList from '@/components/goodList.vue'
export default {
  data() {
    return {
      list: [],
      banner: [],
    };
  },
  mounted() {
    this.getList();
    this.getbanners();
  },
  components: {
    navSwipter,
    TabberBtn,
    goodList
  },
  methods: {
    async getList() {
      let res = await getUserList();
      // console.log(res);
      this.list = res.data;
    },
    async getbanners() {
      let res = await getBanner();
      // console.log(res);
      this.banner = res.data;
    },
  },
};
</script>
<style lang="scss" scoped>
* {
  padding: 0;
  margin: 0;
}
.home {
  position: relative;
  width: 100%;

  background-color: #f2f3f5;
  .my-swipe {
    width: 100%;
    img {
      width: 100%;
      height: 100%;
    }
  }
}
</style>
